static inline USINT WEEKNUM(EN_ENO_PARAMS unsigned int y, unsigned int m, unsigned int d, unsigned int w){
 int days[]={0,31,59,90,120,151,181,212,243,273,304,334};    // Number of days at the beginning of the month in a not leap year.
int DN,WN;
TEST_EN(USINT)
//Start to calculate the number of day
 if (m==1 || m==2){
   DN = days[(m-1)]+d;                     //for any type of year, it calculate the number of days for January or february
 }                        // Now, try to calculate for the other months
 else if ((y % 4 == 0 && y % 100 != 0) ||  y % 400 == 0){  //those are the conditions to have a leap year
   DN = days[(m-1)]+d+1;     // if leap year, calculate in the same way but increasing one day
 }
 else {                                //if not a leap year, calculate in the normal way, such as January or February
   DN = days[(m-1)]+d;
 }
// Now start to calculate Week number
 if (w==0){
   WN = (DN-7+10)/7;             //if it is sunday (time library returns 0)
 }
 else{
   WN = (DN-w+10)/7;        // for the other days of week
 }
 return WN;
}

static inline BOOL BYTE_BIT_TEST(EN_ENO_PARAMS unsigned char val,unsigned char b){
TEST_EN(BOOL)
return val&(1<<b);
}
static inline BOOL WORD_BIT_TEST(EN_ENO_PARAMS unsigned short val,unsigned char b){
    TEST_EN(BOOL)
    return val&(1<<b);
}
static inline BOOL DWORD_BIT_TEST(EN_ENO_PARAMS unsigned int val, unsigned char b) {
    TEST_EN(BOOL)
    return val & (1 << b);
}

static inline WORD BYTE_2_WORD(EN_ENO_PARAMS BYTE LBYTE, BYTE HBYTE) {
    TEST_EN(BOOL)
    return (HBYTE << 8) | LBYTE;
}
